﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>无标题页</title>
    <link href="../../Content/Themes/blue2/css.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../../Content/JS/win_center.js" type="text/javascript"></script>
    <script src="../../Content/JS/layer-v1.7.1/layer/layer.js" type="text/javascript"></script>
    <script type="text/javascript">
        var OldOpenMenu = '';
        var OldOpenMenu3 = '';

        function InitMenu() {

            var arrTb = document.getElementsByTagName("table");
            var iCount = 0;
            for (var i = 0; i < arrTb.length; i++) {
                var strFlag = arrTb[i].getAttribute("Flag");
                if (strFlag != null) {
                    if (strFlag == "1") {
                        if (iCount > 0) {
                            HideTB(arrTb[i].id);
                        }
                        else {
                            OldOpenMenu = arrTb[i].id;
                        }
                        iCount++;
                    }
                }
            }
        }
        //隐藏以打开的第二级菜单
        function HideTB(tbID) {
            var myobj = document.getElementById(tbID);
            if (myobj.rows.length > 0) {
                for (var i = 1; i < myobj.rows.length; i++) {
                    myobj.rows[i].style.display = "none";
                }
            }
        }
        function OpenMenu(MenuCode) {
            HideMenu3();
            if (OldOpenMenu != MenuCode) {
                HideTB(OldOpenMenu);
            }

            OldOpenMenu = MenuCode;

            var myobj = document.getElementById(MenuCode);
            if (myobj.rows.length > 0) {
                for (var i = 1; i < myobj.rows.length; i++) {
                    if (myobj.rows[i].style.display == "none") {
                        myobj.rows[i].style.display = "";
                    }
                    else {
                        myobj.rows[i].style.display = "none";
                    }
                }
            }
        }
        //Flag--第一列或第二列
        //RowIndex,第几行,从零开始算
        function OpenMenu3(evt, MenuCode, Flag, RowIndex) {
            //debugger;
            evt = evt ? evt : (window.event ? window.event : null);
            if (OldOpenMenu3 != MenuCode) {
                HideMenu3();
            }
            var tempx = evt.clientX + document.body.scrollLeft;
            var tempy = evt.clientY + document.body.scrollTop;
            var obj = document.getElementById(MenuCode);
            if (obj == null) { return; }
            if (obj.style.display == "none") {
                obj.style.display = "";
                if (Flag == 1) {
                    obj.style.left = tempx;
                    obj.style.left = 10;
                    RowIndex = RowIndex / 2 + 1;
                }
                else {
                    RowIndex = (RowIndex + 1) / 2; //算出所点元素在第几行
                    obj.style.left = 55;
                }
                obj.style.top = GetObjTop(MenuCode, RowIndex);

                OldOpenMenu3 = MenuCode;
            }
            else {
                obj.style.display = "none";
            }
        }
        //计算元素的top值
        //RowIndex---第几行
        function GetObjTop(MenuCode, RowIndex) {

            var temp = MenuCode.replace('div', 'T');
            var ParID = temp.substring(0, 4);
            var objPar = document.getElementById(ParID);
            var iTop = 0;
            iTop = iTop + objPar.offsetTop;
            if (objPar.rows.length > 0) {
                for (var i = 0; i <= RowIndex; i++) {
                    iTop = iTop + objPar.rows[i].offsetHeight;
                }
            }
            return iTop;
        }

        //隐藏以打开的第三级菜单
        function HideMenu3() {
            if (OldOpenMenu3 != '') {
                var obj = document.getElementById(OldOpenMenu3);
                obj.style.display = "none";
                OldOpenMenu3 = '';
            }
        }
    </script>
    <style type="text/css">
    .MenuList{float:left;width:75px; height:60px; text-align: center; margin-top:4px;}
    </style>
</head>
<body class="left">
    <form name="_ctl0" method="post" action="menu.aspx?id=-1" id="_ctl0">
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJLTM5MDI2Mjg4ZGS+YaiO0mgzgl5W+zbLk68ImvUS1w==" />
    <div class="container" id="container" >
        <div id="trMenu" class="tabmenu">
            
        </div>
    </div>
    <script type="text/javascript">InitMenu();</script>
    </form>
    <script type="text/javascript">
        var list = document.getElementsByTagName("a");
        for (var i = 0; i < list.length; i++) {
            var href = list[i].getAttribute("href");
            if (href == null) continue;
            if (href.indexOf("javascript") > -1) continue;
            if (href.indexOf("#") > -1) continue;
            list[i].setAttribute("href", "/OM/loading.aspx?desktop=" + encodeURIComponent(list[i].getAttribute("href")));
        }
        function settting(url, loading) {
            parent.window.document.getElementById("main").contentWindow.location.href =url;
        }
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return (r[2]); return null;
        }
        window.onload = function () {
            var id = GetQueryString("id");
            $.ajax({
                type: 'GET',
                url: '../../Ajax/CheckHeaderLinkashx.ashx',
                dataType: 'text',
                data: 'id=' + id,
                cache: false,
                success: function (msg) {
                    // document.getElementById("trMenu").innerHTML = msg;
                    if (msg == "登录") {
                     window.parent.location.href = '/Login/Login';
                    }
                    else {
                        $("#trMenu").html(msg);
                    }
                }
            })
        }
        
    </script>
</body>
</html>
